<template>
    <div>
        <div class="zhnsbtop" ref="btop" style="display:block;" @mousemove="zhtop">
        <div class="w1080">
            <div class="left">
                <h3>智能手表</h3>
                <ul>
                    <li @mousemove="hqts(val.id)" v-for="(val,i) in date.children1" :key="i"><a href="javascript:;">{{val.name}} ></a></li>
                </ul>
            </div>
            <div class="right">
                <div class="right-item">
                    <ul>
                        <li v-for="(val, i) in dats" :key="i"  @click="edit(val.id)">
                            <a href="javascript:;">
                                <img :src="'http://www.kymid.com/testphp/public'+ val.image" alt="">
                                <h3>{{val.name_en}}</h3>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    </div>
</template>
<script setup>
import { ref, getCurrentInstance, onMounted, nextTick } from 'vue'
const { proxy } = getCurrentInstance()
onMounted(() => {
hqid()
hqts()
hqids()
hqtsa()
})
const date = ref([])
async function hqid () {
    const { data: res } = await proxy.$http.get('type_list')
    console.log(res.msg)
    date.value = res.msg[1]
}
console.log(date)
const dates = ref([])
async function hqids () {
    const { data: res } = await proxy.$http.get('type_list')
    console.log(res)
    dates.value = res.msg[1]
    console.log(date.value)
}
const dats = ref([])
async function hqts (id) {
    console.log(id)
    const { data: res } = await proxy.$http.get('good_type?product_id=' + id + '&offset=0&limit=8')
    // const { data: res } = await proxy.$http.get('good_type?product_id=6&offset=0&limit=8')
    dats.value = null
    nextTick(() => {
dats.value = res.msg
    })
}
// console.log(dats)
const datss = ref([])
async function hqtsa (id) {
    const { data: res } = await proxy.$http.get('good_type?product_id=' + id + '&offset=0&limit=8')
    datss.value = null
    nextTick(() => {
datss.value = res.msg.slice(0, 4)
    })
}
function edit (id) {
    // console.log(imgs, id)
    // localStorage.setItem('uname', val.data)
    proxy.$store.commit('edit', id)
    proxy.$router.push('/index/particulars')
}
</script>
